<!-- 模板 -->
<template>
    <div class="pop" v-show="show">
        <transition :name="maskerTransition">
            <div class="pop__masker" v-show="isComponentShow" @click="onHide"></div>
        </transition>
        <div class="pop__inner">
            <transition :name="dialogTransition" v-on:after-leave="afterLeave">
                <div class="pop__inner__dialog" v-show='isComponentShow'>
                    <div class="qr">
                        <div class="qr__info">
                            <h2>请长按识别二维码<br>关注凹凸共享租车</h2>
                            <h1>秒杀前15分钟<br>我们会提醒您</h1>
                        </div>
                        <div class="qr__con">
                            <img :src="url">
                        </div>
                    </div>
                    <a href="javascript:;" class="pop-close" @click="onHide"></a>
                </div>
            </transition>
        </div>
    </div>
</template>


<!-- js -->
<script>
    export default{
       data(){
            return{
                show: !1,
                isComponentShow: !1,
                maskerTransition: "aui-pop-masker",
                dialogTransition: "aui-pop"
            }
        },
        props: {
            isShow: {
                type: Boolean,
                default: !1
            },
            url: ""
        },
        watch: {
            isShow(){
                if(!this.isShow){
                    return;
                }
                this.show = 1;

                setTimeout(() => {
                    this.isComponentShow = !0;
                }, 10);
            }
        },
        methods: {
             onHide() {
                this.isComponentShow = !1;
            },
            // 点击确认按钮之后，可能会存在回调事件
            afterLeave(){
                this.show = !1;
                // 回调
                this.$emit('on-cb');
            }
        }
    }
</script>

<!-- scss -->
<style scoped lang="scss">
    @import "../../styles/views/pop.scss";
    .pop__inner__dialog{
            position: relative;
            overflow: hidden;
            width: 5rem;
            color: #fff;
            padding-bottom:1.8rem;
            pointer-events: auto;
        }
    .qr{
        width: 5.0rem;
        &__info{
            padding: 0.4rem;
            background: #fff;
            border-radius: 5px 5px 0 0;
            >h1{
                color: #114384;
                font-size: 0.44rem;
                line-height: 0.55rem;
                text-align: center;
                font-weight: bold;
            }
            >h2{
                color: #8c8c8c;
                font-size: 0.34rem;
                line-height: 0.45rem;
                text-align: center;
            }
        }
        &__con{
            border-radius: 0 0 5px 5px;
            width: 100%;
            height: 4.3rem;
            background: url("../../assets/images/pop_sign_bg.jpg") 50% no-repeat;
            background-size: cover;
            @include flexbox;
            @include flexCenterHori;
            @include flexCenterVeri;
            img{
                display: block;
                width: 3.2rem;
                height: 3.2rem;
            }
        }
    }

    .pop-close{
        width: 0.6rem;
        height: 0.6rem;
        display: block;
        position: absolute;
        bottom: 0.1rem;
        left: 50%;
        margin-left: -0.3rem;
        background: url("../../assets/images/icon_close.png") 50% no-repeat;
        background-size: 0.6rem; 
        &:active{
            transform: scale(1.1);
        }
    }
</style>
